#ifndef __RSSB_H__
#define __RSSB_H__

#include <jni.h>
#include "redobject.h"

typedef enum
{
	IntValue,
	CharValue,
	LongValue,
	ShortValue,
	BooleanValue,

	FloatValue,
	DoubleValue,

	VoidValue,
	ArrayValue,
	StringValue,
	ObjectValue,
} ValueType;

typedef struct _Array
{
	RedObject_HEAD

	JNIEnv		*env;
	ValueType	 type;
	jclass		 Class;
	jarray		 content;
} Array;

typedef struct _Method
{
	RedObject_HEAD

	JNIEnv		*env;
	jobject		 self;
	RedObject	*name;

	int			 count;
	jobject		*overrides;
} Method;

typedef struct _ScalaObject
{
	RedObject_HEAD

	JNIEnv		*env;
	jobject		 object;
} ScalaObject;

void array_release(RedObject *self);
RedObject *array_repr(RedObject *self);
RedObject *array_delitem(RedObject *self, RedObject *key);
RedObject *array_getitem(RedObject *self, RedObject *key);
RedObject *array_setitem(RedObject *self, RedObject *key, RedObject *value);

void method_release(RedObject *self);
RedObject *method_invoke(RedObject *self, RedObject *args);

uint32_t object_hash(RedObject *self);
void object_release(RedObject *self);
RedObject *object_eq(RedObject *self, RedObject *other);
RedObject *object_str(RedObject *self);
RedObject *object_repr(RedObject *self);
RedObject *object_delattr(RedObject *self, RedObject *attr);
RedObject *object_getattr(RedObject *self, RedObject *attr);
RedObject *object_setattr(RedObject *self, RedObject *attr, RedObject *value);

extern RedTypeObject ArrayType;
extern RedTypeObject MethodType;
extern RedTypeObject ScalaObjectType;
extern RedTypeObject ScalaExceptionType;

#endif
